home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Cinema 4D GO demo / Plugin / Modeling / Propeller.cof < prev    next >
Text File  |  1998-03-16  |  901b  |  42 lines

  1. // This script adds an object with 2 triangles to the active document
  2. // (c) Christian Losch 1997
  3. // Maxon Computer GmbH
  4.  
  5. Function(doc)
  6. {
  7.     var m = new(Matrix);
  8.  
  9.     // Make object with 5 points 6 edges and 2 triangles 0 quadrangles
  10.     var op = doc->NewPolygonObject("Propeller",NULL,NULL,5,6,2,0);
  11.  
  12.     op->SetPoint(0,vector(-100,-100,0));
  13.     op->SetPoint(1,vector(-100, 100,0));
  14.     op->SetPoint(2,vector(   0,   0,0));
  15.     op->SetPoint(3,vector( 100, 100,0));
  16.     op->SetPoint(4,vector( 100,-100,0));
  17.  
  18.     op->SetEdge(0,0,1);
  19.     op->SetEdge(1,1,2);
  20.     op->SetEdge(2,2,3);
  21.     op->SetEdge(3,3,4);
  22.     op->SetEdge(4,4,2);
  23.     op->SetEdge(5,2,0);
  24.  
  25.     op->SetTriangle(0,0,1,2);
  26.     op->SetTriangle(1,2,3,4);
  27.  
  28.     // Object Update
  29.     op->UpdateObject();
  30.  
  31.     // Activate object
  32.     doc->ActivateObject(op);
  33.  
  34.     // Refresh
  35.     doc->SendMessage(DOCUMENT_CHANGED);
  36.  
  37. }
  38.  
  39. main()
  40. {
  41.     RegisterMenuHook("Propeller","Function");
  42. }